﻿/*
 * AxisList
 * 
 * initial implementation : 20.11.2008
 *
 * Copyright (c) Adam Sida, asida@centrum.cz.
 * All rights reserved.
 * 
 * for license see Petra.Gis.License.txt
 */

//using System.Runtime.Serialization;
using System.Collections.Generic;


namespace Petra.Gis.ReferenceSystemServices
{
  /// <summary>
  /// List of Axes
  /// </summary>
  //[DataContract]
  public class AxisList : List<Axis> 
  {

    public AxisList()
      : base() { }



    public AxisList(IEnumerable<Axis> axes)
      : base(axes) { }





    public bool EqualParams(AxisList otherAxisList, CsCompareType compareType)
    {
      bool found;

      // axis compare must go one by one in loop
      // axis might have different order and upper/lower case in name...
      foreach (Axis a in this)
      {
        found = false;
        foreach (Axis oa in otherAxisList)
          if (a.Name.ToLower() == oa.Name.ToLower())
          {
            // if must compare axes and axes has different direction
            // return false
            if (compareType != CsCompareType.SkipProjectionAxesOrientation && a.Orientation != oa.Orientation)
            {
              return false;
            }
            else
            {
              found = true;
              break;
            }
          }

        if (!found)
          return false;
      }
      return true;
      
    }
    

  }

}
